home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / ScriptX / Draggable ScriptX Folders / utils / widgets / wdgtest.sx < prev    next >
Encoding:
Text File  |  1995-12-17  |  3.8 KB  |  130 lines  |  [TEXT/ttxt]

  1. -- <<<
  2. -- file wdgtest.sx
  3. open LibraryContainer path:"widgets.sxl"
  4. Module test
  5.     uses ScriptX, WidgetInterface
  6. end
  7. in module test
  8. global w := new Window
  9. w.fill := new Brush pattern:(importDIB "media/bkgnd.bmp")
  10. show w
  11. global ac := new ActuatorController space:w wholeSpace:true
  12.  
  13. -- StencilButton
  14. global bitmapButton := new StencilButton \
  15.     stencil:(importDIB "media/kicon.bmp")
  16. bitmapButton.position := new Point x:35 y:14
  17. global sbCaption := new Label text:"StencilButton"
  18. sbCaption.position := new Point x:10 y:60
  19. append w sbCaption
  20. append w bitmapButton
  21.  
  22. -- TextButton
  23. global textB := new TextButton text:"Kaleida!"
  24. textB.position := new Point x:120 y:30
  25. global tbCaption := new Label text:"TextButton"
  26. tbCaption.position := new Point x:120 y:60
  27. append w tbCaption
  28. append w textB
  29.  
  30. -- ScrollListBox
  31. global wdgclass_list := #("ColorScheme", "FontContext", "Frame", \
  32.     "Label", "GenericButton", "RadioButton", "CheckBox", \
  33.     "StencilButton", "TextButton", "PopUpButton", "RadioGroup", \
  34.     "ListBox", "SmallTextEdit", "ListSelection", \
  35.     "SimpleScrollBar", "ScrollingTextEdit", "ScrollBox", \
  36.     "MultiListBox", "ScrollListBox", "PopUpMenu")
  37.                 
  38. global slb := new ScrollListBox list:wdgclass_list \
  39.     boundary:(new Rect x2:135 y2:210) \
  40.     hasScrollBar:true
  41. slb.x := 10
  42. slb.y := 150
  43. global slbCaption := new Label text:"ScrollListBox"
  44. slbCaption.position := new Point x:10 y:120
  45. append w slbCaption
  46. append w slb
  47.  
  48. -- CheckBox
  49. global cb := new CheckBox text:"Check Me" frame:(new Frame)
  50. cb.x := 170; cb.y := 130
  51. global cbCaption := new Label text:"CheckBox"
  52. cbCaption.position := new Point x:170 y:100
  53. append w cbCaption
  54. append w cb
  55.  
  56. -- Radio Button
  57. global rb := new RadioButton text:"On/Off" frame:(new Frame)
  58. rb.x := 170; rb.y := 210
  59. global rbCaption := new Label text:"RadioButton"
  60. rbCaption.position := new Point x:170 y:180
  61. append w rbCaption
  62. append w rb
  63.  
  64. -- Radio Group
  65. global rg := new RadioGroup \
  66.     itemList:#(@one:"One", @two:"Two", @three:"Three")
  67. rg.position := new Point x:170 y:290
  68. global rgCaption := new Label text:"RadioGroup"
  69. rgCaption.position := new Point x:170 y:260
  70. append w rgCaption
  71. append w rg
  72.  
  73. -- SmallTextEdit
  74. global smallTE := new SmallTextEdit text:("120" as Text) \
  75.     boundary:(new Rect x2:35 y2:20)
  76. smallTE.x := 230
  77. smallTE.y := 30
  78. global steCaption := new Label text:"SmallTextEdit"
  79. steCaption.position := new Point x:210 y:60
  80. append w steCaption
  81. append w smallTE
  82.  
  83. -- PopUpMenu
  84. global puMenu := new PopUpMenu \
  85.     list:#(@one:"one",@two:"two",@fewWords:"A Few Words") \
  86.     width:104 actuatorController:undefined layoutController:undefined
  87. -- PopUpButton
  88. global popUpB := new PopUpButton menu:puMenu value:@two
  89. popUpB.x := 330
  90. popUpB.y := 50
  91. global pumCaption := new Label text:"PopUpMenu"
  92. pumCaption.position := new Point x:330 y:20
  93. append w pumCaption
  94. append w popUpB
  95.  
  96. -- MultiListBox
  97. global mlb := new MultiListBox boundary:(new Rect x2:120 y2:120) \
  98.     list:#(#(1,@one), #(2,@two), #(3,@three), #(4,@four), \
  99.         #(5,@five),#(6,@six),#(7,@seven))
  100. mlb.x := 460
  101. mlb.y := 50
  102. global mlbCaption := new Label text:"MultiListBox"
  103. mlbCaption.position := new Point x:460 y:20
  104. append w mlbCaption
  105. append w mlb
  106.  
  107. -- ScrollingTextEdit
  108. global TEstream := getStream theScriptDir "media/scrollte.txt" \
  109.     @readable
  110. global TEtext := importMedia theImportExportEngine TEstream @Text \
  111.     @ASCIItext @TextEdit
  112. global scrollTE := new ScrollingTextEdit \
  113.     boundary:(new Rect x2:280 y2:160) \
  114.     textWidth:260 textHeight:600 text:TEtext autoRecalc:false
  115. scrollTE.x := 300
  116. scrollTE.y := 200
  117. global scteCaption := new Label text:"ScrollingTextEdit"
  118. scteCaption.position := new Point x:300 y:170
  119. append w scteCaption
  120. append w scrollTE
  121. global txtPres := scrollTE.targetPresenter
  122.  
  123. global tc := new TitleContainer dir:theScriptDir path:"wdgtest.sxt" \
  124.     name:"Widget Kit Test"
  125. w.title := tc
  126. append tc (getModule @test)
  127. tc.startupAction := (tc -> for i in tc do load i; show w)
  128. close tc
  129. -- >>>
  130.